package com.ybf.user.dal.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.ybf.user.dal.BeanUtils;
import lombok.Data;

import java.util.Date;

/**
 * base do
 *
 * @author 向南
 * @date 14:26 2023/7/5
 **/
@Data
public class BaseDO {

    @TableField("id")
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create",fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @TableField(value = "gmt_modified",fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 删除标识 1-删除
     */
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleted;

    /**
     * DO -> DTO
     *
     * @author 向南
     * @date 17:52 2023/7/5
     * @param: tClass
     **/
    public <T> T convertToDTO(Class<T> tClass){
        return (T) BeanUtils.copyBean(this, tClass);
    }

}
